import React from 'react';
import { TabBar } from "antd-mobile"
import { withRouter } from "react-router-dom"
import './Mytab.css'

class MyTab extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			selectedTab: 'blueTab',
		};
	}
	render() {	
		const { pathname } = this.props.location;
		return (
			<div style={{ position: 'fixed', width: '100%', bottom: 0 ,zIndex:3}}>
				<TabBar
					unselectedTintColor="#ccc"
					tintColor="#ccc"
					barTintColor="rgb(47,49,67)"
				>
					<TabBar.Item
						icon={
							<i className='iconfont icon-zhuye'></i>
						}
						selectedIcon={
							<i className='iconfont icon-zhuye1'></i>
						}
						title="主页"
						key="home"
						selected={pathname === '/home/hot'||'/home/recent'}
						onPress={() => {
							this.props.history.push('/home')
						}}
						data-seed='logId1'
					>
					</TabBar.Item>

					<TabBar.Item
						icon={
							<i className="iconfont icon-liebiao"></i>
						}
						selectedIcon={
							<i className="iconfont icon-liebiao1"></i>
						}
						title="所有"
						key="all"
						// selected={pathname === '/all/所有&所有'}
						onPress={() => {
							this.props.history.push('/all')
						}}
						data-seed="logId1"
					>
					</TabBar.Item>

					<TabBar.Item
						icon={
							<i className='iconfont icon-shequ'></i>
						}
						selectedIcon={
							<i className="iconfont icon-shequ-active"></i>
						}
						title="社区"
						key="comm"
						selected={pathname === '/comm'}
						onPress={() => {
							this.props.history.push('/comm')
						}}
						data-seed="logId1"
					>
					</TabBar.Item>

					<TabBar.Item
						icon={
							<i className='iconfont icon-xiaoxi1'></i>
						}
						selectedIcon={
							<i className='iconfont icon-xiaoxi'></i>
						}
						title="消息"
						key="mess"
						selected={pathname === '/mess'}
						onPress={() => {
							this.props.history.push('/mess')
						}}
						data-seed='logId1'
					>
					</TabBar.Item>
					<TabBar.Item
						icon={
							<i className='iconfont icon-me'></i>
						}
						selectedIcon={
							<i className='iconfont icon-04f'></i>
						}
						title="我的"
						key="me"
						selected={pathname === '/me'}
						onPress={() => {
							this.props.history.push('/me')
						}}
						data-seed='logId1'
					>
					</TabBar.Item>
				</TabBar>
			</div>
		);
	}
}
export default withRouter(MyTab);